//
//  SNShopBrandsadModel.m
//  app
//
//  Created by 王少宁 on 15/8/20.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "SNShopBrandsadModel.h"

@implementation SNShopBrandsadModel

- (instancetype)initWithArray:(NSArray *)array
{
    if ([super initWithArray:array]) {
        
        if (array && array.count) {
            NSMutableArray * mutableArray = [NSMutableArray array];
            for (NSDictionary * dic in array) {
                SNShopBrandsadSubModel * model = [SNShopBrandsadSubModel modelWithDict:dic];
                [mutableArray addObject:model];
            }
            _brandsadArray = mutableArray;
            
            self.rowNumber = 1;
            self.cellHeight = SCREEN_WIDTH * 220/720;
        }
    }
    return self;
}

@end







@implementation SNShopLinkurlModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end




@implementation SNShopLinkurlListModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        _brand_id = [dict[@"brand_id"] stringValue];
        _brand_name = dict[@"brand_name"];
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end




@implementation SNShopLinkurlDetailModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        _shop_id = [dict[@"shop_id"] stringValue];
        _product_id = [dict[@"product_id"] stringValue];
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end






@implementation SNShopBrandsadSubModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        _ad_id = [dict[@"ad_id"] stringValue];
        _ad_name = dict[@"ad_name"];
        _ad_pic = dict[@"ad_pic"];
        _ad_pic_width = [dict[@"ad_pic_width"] stringValue];
        _ad_pic_height = [dict[@"ad_pic_height"] stringValue];
        _ad_type = [dict[@"ad_type"] stringValue];
        NSDictionary * linkurlDic = dict[@"linkurl"];
        if (linkurlDic && linkurlDic.allKeys.count) {
            
            if ([_ad_type isEqualToString:@"2"]) {
                _linkurlModel = [SNShopLinkurlListModel modelWithDict:linkurlDic];
            } else if ([_ad_type isEqualToString:@"4"]) {
                _linkurlModel = [SNShopLinkurlDetailModel modelWithDict:linkurlDic];
            }
            
        }
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end







